﻿
@{
    Layout = null;
}

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="favicon.ico">
    <title>Mango后台管理系统</title>
    <!-- Bootstrap core CSS -->
    <link href="~/style/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <!-- Custom styles for this template -->
    <link href="~/style/bootstrap/css/floating-labels.css" rel="stylesheet">
</head>
<body>
    <form class="form-signin" id="formLogin"  action="/Home/Login" method="post">
        <div class="text-center mb-4">
            <h1 class="h3 mb-3 font-weight-normal">51Core.Net后台管理系统</h1>
            <p>专注于.NET CORE</p>
        </div>
        <div class="form-label-group">
            <input type="text" id="adminName" name="adminName" maxlength="30" class="form-control" placeholder="请输入账号" autofocus="">
        </div>
        <div class="form-label-group">
            <input type="password" id="password" name="password" maxlength="30" class="form-control" placeholder="请输入密码" >
        </div>
        <div class="input-group form-label-group">
            <input type="text" id="code" name="code" maxlength="4" class="form-control col-10" placeholder="请输入验证码" style="width:100px;">

            <div class="input-group-append">
                <img src="/Authorization/ValidateCode" alt="" title="看不清?点击更换" onclick="this.src = this.src + '?'" style="vertical-align:middle;">
            </div>
        </div>
        <button class="btn btn-lg btn-primary btn-block" type="button" id="btn_Login">登 录</button>
        <p class="mt-5 mb-3 text-muted text-center">© 2018 https://www.51core.net</p>
    </form>
    <script src="~/lib/jquery/jquery-3.2.0.min.js" type="text/javascript"></script>
    <script src="~/lib/jquery/jquery.form.js" type="text/javascript"></script>
    <script src="~/lib/layer/layer.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $('#btn_Login').on('click', function () {
                var adminName = $('input[name="adminName"]').val();
                var password = $('input[name="password"]').val();
                var code = $('input[name="code"]').val();

                //判断是不是手机号码
                if (adminName == "") {
                    layer.tips('账号不能为空', '#adminName', {
                        tips: [2, '#3595CC'],
                        time: 2000
                    });
                }
                else if (password == "") {
                    layer.tips('密码不能为空', '#password', {
                        tips: [2, '#3595CC'],
                        time: 2000
                    });
                }
                else if (code == "") {
                    layer.tips('验证码不能为空', '#code', {
                        tips: [2, '#3595CC'],
                        time: 2000
                    });
                }
                else {
                    $("#formLogin").ajaxSubmit({
                        success: function (res) {
                            if (res == "ok") {
                                window.location.href = '/Home/Index';
                            }
                            else {
                                layer.tips(res, '#btn_Login', {
                                    tips: [2, '#3595CC'],
                                    time: 2000
                                });
                            }
                        }
                    });
                }
            });
        });
    </script>
</body>
</html>